package com.hzcx.app.simplechat.ui.setting.presenter;

import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.api.BaseObserver;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.model.FriendModel;
import com.hzcx.app.simplechat.model.SettingModel;
import com.hzcx.app.simplechat.ui.friend.bean.FriendBean;
import com.hzcx.app.simplechat.ui.friend.bean.FriendCityBean;
import com.hzcx.app.simplechat.ui.friend.bean.FriendLableListBean;
import com.hzcx.app.simplechat.ui.setting.bean.GroupMessageListBean;
import com.hzcx.app.simplechat.ui.setting.contract.GroupMessageListContract;
import com.hzcx.app.simplechat.ui.setting.contract.GroupMsgFriendListContract;

import java.util.List;

public class GroupMsgFriendListPresenter extends BasePresenter<GroupMsgFriendListContract.View> implements GroupMsgFriendListContract.Presenter {

    /**
     *  获取好友列表
     * @param context
     */
    @Override
    public void getFriendList(Context context,int type,boolean isShow) {
//        FriendModel.getFriendList(context, new BaseObserver<List<FriendBean>>() {
//            @Override
//            protected void onSuccess(List<FriendBean> data) {
//                mView.friendListResult(data);
//            }
//
//            @Override
//            public void onFailure(Throwable e, String errorMsg) {
//                super.onFailure(e, errorMsg);
//                mView.hideLoading();
//            }
//        });

        FriendModel.getFriendBySort(context, null, type + "", new BaseDialogObserver<List<FriendCityBean>>(context,isShow) {
            @Override
            protected void onSuccess(List<FriendCityBean> data) {
                mView.friendListResult(data,type);
            }

            @Override
            public void onFailure(Throwable e, String errorMsg) {
                super.onFailure(e, errorMsg);
                mView.hideLoading();
            }
        });
    }

    /**
     *  获取标签列表
     * @param context
     */
    @Override
    public void getFriendLableList(Context context) {
        FriendModel.getFriendLableList(context, new BaseObserver<List<FriendLableListBean>>() {
            @Override
            protected void onSuccess(List<FriendLableListBean> data) {
                mView.lableResult(data);
            }

            @Override
            public void onFailure(Throwable e, String errorMsg) {
                super.onFailure(e, errorMsg);
                mView.hideLoading();
            }
        });
    }
}
